package com.xiumu.search.repository;

import com.xiumu.search.model.elasticsearch.UserInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author xiumu
 * @version 1.0
 * @date 2020/11/8 15:09
 */
@Repository
public interface UserInfoRepository extends ElasticsearchRepository<UserInfo, String> {

    @Override
    List<UserInfo> findAll();

    //根据名字查找
    List<UserInfo> findByUsername(String username);
    //根据年龄查找
    List<UserInfo> findByAge(Integer age);
    //根据名字或者个性签名查找
    List<UserInfo> findByUsernameOrDescription(String username, String description);
    //分页查询
    @Override
    Page<UserInfo> findAll(Pageable pageable);
    //根据名字分页查询
    Page<UserInfo> findByUsername(String username,Pageable pageable);
}
